import store from "@/store";
import axios from "axios";
import QS from 'qs';


const instance = axios.create({
    baseURL: '/api',
    timeout: 2000
});
instance.defaults.headers.common['Authorization'] = store.state.token == '' ? '' : store.state.token;

instance.interceptors.request.use(config => {
    config.data = QS.stringify(config.data)
    console.log(config);
    return config;
}, error => {
    console.log(error);
    return error;
})

export default instance;